<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" language="javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery.address-1.3.2.min.js?state=/home"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-bubble.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-map-bubble.js"></script>
<script type="text/javascript" language="javascript" src="/js/stringhelper.js"></script>
<script type="text/javascript" language="javascript" src="/js/staticContent.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery.tools.scrollable.js"></script>
<script type="text/javascript" language="javascript" src="/js/map.js"></script>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<script>

    	$.address.init(function() {
    		// Initializes the plugin
    		$('ul li').not('.hasbubble').find('a').address();
    		}).change(function(event) {
    			var value = $.address.state().replace(/^\/$/,'') + event.value;
    			//select the proper nav link
    			setClassSelected(value);
    			var path;
    			if(value=="" || value== "/home/")
    			{
    				path = "home.Home";	
    			}
    			if(value=="/home/headlines")
    			{
    				path = "feeds.Feedzilla";	
    			}
    			if(value=="/home/map")
    			{
    				path="search.MapSearchPage";
    			}
    			if(value=="/home/myproperties")
    			{
    				path="propmanager.PropertyManagerPage";
    			}
    			if(event.queryString)
    			{
    				path+="&"+event.queryString;	
    			}
    			
    				if(path)
	    				doPost(path);
    	});
  
    	function doPost(path,submitData,elem)
    	{
    		$.post("http://173.174.75.85/ajaxCall.jsp?do="+encodeURIComponent(path),submitData,function(data, textStatus, XMLHttpRequest) {
				if(data)
				{
					handler(data,elem);
				}
			});
    	
	    	// Handles response
			var handler = function(data,elem) {
					if(data) {
						if(data.HOME)
						{
	    					$('#workspace').html(data.HOME).show().find('.scrollable').scrollable();
						}
						else if(data.article) {
							var articlebubble = $('#main').data('bubble');
							articlebubble.setTitle(data.article.title);
							articlebubble.setSubheader('<div>'+StringHelper.striphtml((data.article.author?data.article.author+' - ':'')+data.article.source)+'</div><div>'+data.article.publish_date.substring(0,17)+'</div><a target=\"_new\" href=\"'+data.article.url+'\">Read Full Article</a>');
							articlebubble.setBody(data.article.summary);
							articlebubble.setFooter('<b>&nbsp;</b><a class=\"prev\" onclick=\"doPost(\'feeds.Feedzilla\',{prev:\'1\'});\"> &#x25B2; prev</a><a class=\"prev\" onclick=\"doPost(\'feeds.Feedzilla\',{next:\'1\'});\">next &#x25BC;</a>');
	    				}
						else if(data.map)
						{
							$('#workspace').html(data.map);
							MapJS.initializeMap();
						}
						else if(data.mapresults)
						{
							if(data.mapresults[0].length>0) {
								MapJS.applyMapResults(data.mapresults);
								$(MapJS.markersArray).each(function() {
									var markerObj = this;
									google.maps.event.addListener(this.marker,"click", function(){ 
									   doPost('reports.MapReport',{'zillowID':markerObj.id[0]},this);
									});
									
								});
							}
							else
								alert('Your search returned no listings');
						}
						else if(data.listingMapPopup)
						{
							MapJS.getInfoWindow().setContent(data.listingMapPopup);
							MapJS.getInfoWindow().open(MapJS.getMap(),elem);
						}
						else if(data.propManager)
						{
							$('#workspace').html(data.propManager);
							$('.sidepanel ul li').click(function() {$(this).find('ul').slideToggle();}).hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});
						}
						
					}
			};
    	}
    	
    	function setClassSelected(value)
    	{
    		$('ul li a').each(function() {
				if($(this).attr('href')== value || $(this).attr('selectedClass')==value ) {
					$(this).parent().addClass('selected');
				} else {
					$(this).parent().removeClass('selected');
				}
			});
    	}
</script>
<script>
$(document).ready(function() {
	$('#main').bubble({onClose:function(){$('#main').data('bubble').reset();$('.toolbar ul li').removeClass('selected');},autoclose:true,popupItemSelector:$(".toolbar .hasbubble,#footer a")});
	$('.toolbar ul li').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});
	$('#main > #footer').width($(window).width()-10);
	$(window).resize(function() {$('#map_canvas').height($(this).height()-160);$('#main > #footer').width($(window).width()-10);});
});
</script>
<script type="text/javascript">

  
  function doMapSearch() {
	  var fieldvalues = [];
	  $('input[type=\"text\"],select').each(function() {
		  var elem = $(this);
		 fieldvalues.push(elem.attr('name')+':'+elem.val().replace(/:/g,''));
	  });
	 doPost('search.PerformMapSearch',{'searchfields':fieldvalues.join(',')});
  }
  

  function toggleSidePanel(elem) {
		var slidepx = parseInt($('div#mainContent').css('marginLeft'),10);
		if(slidepx <11)
		{
			$(elem).removeClass('closed').css('background','url(/images/icons/leftarrow.png)');	
			slidepx=200;
		}
		else
		{
			$(elem).addClass('closed').css('background','url(/images/icons/rightarrow.png)');
			slidepx=-20;
		}
		$('div#mainContent').animate({marginLeft:slidepx}, {duration:'fast'});
	};
	
	function showLogin(el) {
	}
</script>
<title>Property Monitor</title>
</head>
<body>
<div id="main">
<div id="header"><h1>Property Monitor</h1></div>
<!--  top navigation -->
<div class="toolbar">
<ul class="nav">

<!--  Home -->
<li><a id="home" href="/home/" class="selected">Home</a></li>
<!-- Tools -->
<li><a id="tools" href="javascript:">Tools</a>
<ul><li><a href="/home/myproperties" >Property Management</a></li><li><a href="/home/reports" >Reports</a></li><li><a href="/home/marketTrends" >Market Trends</a></li><li><a id="calculators" >Calculators</a></li></ul></li>

<!-- Search -->
<li><a id="search" href="/home/map">Search</a></li>

<!-- Resources -->
<li><a id="resources"  href="javascript:">Resources</a>
<ul style="width:120px;"><li><a href="/blog" rel="#/blog">Blog</a></li><li><a href="/help" rel="#/help">Help</a></li><li><a href="/faq" rel="#/faqs">FAQs</a></li></ul></li>

<!-- Login -->
<li class="hasbubble"><a id="login" selectedClass="login" onclick="setClassSelected('login');showLogin(this);return false;" >Login</a></li>

<li class="hasbubble"><a id="headlines" onclick="doPost('feeds.Feedzilla');return false;">Headlines</a></li></ul>
</div>
<div id="workspace">
</div>
<div id="footer"><div style="text-align:right;padding-right:4px;">&nbsp;&copy;2011 <a>ESOcommerce</a> | <a onclick="StaticContent.openAbout()">About</a> | <a>Feedback</a></div></div>
</div>
</body>
</html>